
Imports Google.GData.Calendar
Imports Google.GData.Client
Imports Google.GData.Extensions
Partial Class NewAppointment
    Inherits BasePage



    Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
        Dim theService As New CalendarService("BYUMiller Lab")
        theService.setUserCredentials("byumillerlab@gmail.com", "testing247")

        Dim entry As EventEntry = New EventEntry()

        ' Set the title and content of the entry.
        'entry.Title.Text = "Tennis with Beth"
        entry.Title.Text = txtEvent.Text
        entry.Content.Content = txtDescription.Text


        ' Set a location for the event.
        Dim eventLocation As New Where
        eventLocation.ValueString = txtRoom.Text
        entry.Locations.Add(eventLocation)

        Dim eventTime As New [When]
        eventTime.StartTime = startDate.Text + " " + startTime.Text
        eventTime.EndTime = endDate.Text + " " + endTime.Text
        entry.Times.Add(eventTime)

        Dim PostUri As Uri = New Uri("http://www.google.com/calendar/feeds/default/private/full")

        ' Send the request and receive the response:
        Dim insertedEntry As AtomEntry = theService.Insert(PostUri, entry)

        Response.Redirect("~/Calendar.aspx")


    End Sub
End Class
